var xtKnowledgeWinEdit;
var xtKnowledgeFormEdit;
function updateXtKnowledge(){
	var record = grid.getSelectionModel().selected;
	if(record.length == 0){
		msgTishi("请选择要修改的一项！");
		return;
	}
	initXtKnowledgeFormEdit();
	reGetWidthAndHeight();
	xtKnowledgeWinEdit = Ext.create('Ext.Window',{
		layout:'fit',
		width:clientWidth*0.8,                    
		height:clientHeight, 
		maximizable:true,
		minimizable:true,
		animateTarget:document.body,
		plain:true,
		modal:true,
		title:'编辑信息',
		listeners:{
			minimize:function(win,opts){
				if(!win.collapse()){
					win.collapse();
				}else{
					win.expand();
				}
			}
		},
		items:xtKnowledgeFormEdit,
		buttons:[{
			text:'保存',
			itemId:'save',
			handler:function(button){
				submitForm(xtKnowledgeFormEdit,'../xtKnowledgeController/updateXtKnowledge',grid,xtKnowledgeWinEdit,false,true);
			}
		},{
			text:'关闭',
			itemId:'close',
			handler:function(button){
				button.up('window').close();
			}
		}]
	});
	xtKnowledgeWinEdit.show();
	loadFormData(xtKnowledgeFormEdit,'../xtKnowledgeController/getXtKnowledgeById?xt_knowledge_id='+ record.items[0].data.xt_knowledge_id);
}
function initXtKnowledgeFormEdit(){
	xtKnowledgeFormEdit = Ext.create('Ext.FormPanel',{
		xtype:'form',
		waitMsgTarget:true,
		defaultType:'textfield',
		autoScroll:true,
		fieldDefaults:{
			labelWidth:66,
			labelAlign:'left',
			flex:1,
			margin:'2 5 4 5'
		},
		/**新方法使用开始**/  
        scrollable:true,  
        scrollable:'x',
        scrollable:'y',
        /**新方法使用结束**/ 
		items:[
		{
			fieldLabel:'ID',
			xtype:'textfield',
			hidden:true,
			name:'xt_knowledge_id',
			allowBlank:false,
			maxLength:32,
			anchor:'100%'
		},
		{
			fieldLabel:'标&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;题',
			xtype:'textfield',
			name:'xt_knowledge_title',
			allowBlank:false,
			maxLength:200,
			anchor:'100%'
		},
		{
			fieldLabel:'类&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;型',
			name:"xt_type",
            hiddenName:'xt_type',
            xtype:"combo",
            store:[["-1","请选择"],["0","平台问题"],["1","学习知识"]],
            emptyText:"请选择",
            mode:"local",
            triggerAction:"all",
            editable:false,
			allowBlank:false,
			maxLength:20,
			anchor:'40%'
		},
		{
			fieldLabel:'状&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;态',
			name:"xt_state",
            hiddenName:'xt_state',
            xtype:"combo",
            store:[["-1","请选择"],["0","待解决"],["1","已解决"]],
            emptyText:"请选择",
            mode:"local",
            triggerAction:"all",
            editable:false,
			allowBlank:false,
			maxLength:20,
			anchor:'40%'
		},
		{
			fieldLabel:'级&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;别',
			name:'xt_level',
            hiddenName:'xt_level',
            xtype:"combo",
            store:[["-1","请选择"],["1","紧急"],["2","正常"],["3","一般"]],
            emptyText:"请选择",
            mode:"local",
            triggerAction:"all",
            editable:false,
			allowBlank:false,
			maxLength:20,
			anchor:'40%'
		},
		{
			fieldLabel:'内&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;容',
			xtype:'htmleditor',
			name:'xt_knowledge_content',
			allowBlank:false,
			height:260,
			maxLength:4294967295,
			anchor:'100%'
		},
		{
			fieldLabel:'创建时间',
			xtype:'textfield',
			name:'xt_time',
			allowBlank:false,
			editable:false,
			anchor:'40%'
		},
		{
			fieldLabel:'创&nbsp;&nbsp;建&nbsp;者',
			xtype:'textfield',
			name:'xt_userinfo_realName',
			allowBlank:false,
			editable:false,
			anchor:'40%'
		}
		]
	});
}
